package 泛型.可变参数与泛型方法;

import java.util.ArrayList;
import java.util.List;

public class GenericVarargs {
	/**
	 *
	 * @param args
	 * @param <T>
	 * @return
	 */
	public static <T> List<T> makeList(T... args) {
		ArrayList<T> result = new ArrayList<>();
		for (T item : args) {
			result.add(item);
		}
		return result;
	}

	public static void main(String[] args) {
		List<String> ls = makeList("A");
		System.out.println(ls);
		List<String> strings = makeList("A", "B", "C");
		System.out.println(strings);
		List<String> strings1 = makeList("ABCDEFGHIJKLMN".split(""));
		System.out.println(strings1);

	}
}
